First, make sure you are using the elasticsearch search engine. You can't run this kind of query on the database search engine.
Then, you want to use a range query: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html
You want to build your query string. This is a query string that gives you all the users between the two insertInstants on the user object (inclusive):
{ "range": { "insertInstant": { "gte": 1592231314000, "lte": 1592231315735 } } }Omit the gte key if you only want users before a certain time.
Next is to turn it into an API call against the user search API, which means escaping the query's json and turning it into a JSON object suitable for FusionAuth to parse:
curl -XPOST -H 'Content-type: application/json' -H "Authorization: $API_KEY" 'https://HOSTNAME/api/user/search?' -d ' { "search" : { "query" : "{\"range\" : { \"insertInstant\" : { \"gte\" : 1592231314000, \"lte\" : 1592231315735}} }"}}'Finally, after testing to make sure you're getting the users back you want, you can run the bulk delete API, as documented here: https://fusionauth.io/docs/v1/tech/apis/users#bulk-delete-users
Tested with Elasticsearch 7.